//
//  DebtViewing.m
//  TenThousand
//
//  Created by 我的 on 16/7/27.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "DebtViewing.h"

@interface DebtViewing ()<UIAlertViewDelegate>
@property (weak, nonatomic) IBOutlet UILabel *zhuanrangbianhao;//转让编号
@property (weak, nonatomic) IBOutlet UILabel *zhuanrangjiage;//转让价格

@property (weak, nonatomic) IBOutlet UILabel *Reimbursement;//还款方式
@property (weak, nonatomic) IBOutlet UILabel *data;//日期

@property (weak, nonatomic) IBOutlet UIView *backView;
@end

@implementation DebtViewing

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self createLeft:[UIImage imageNamed:@"ZHSZicon_03"] leftClick:^{
        [self.navigationController popViewControllerAnimated:YES];
    } right:nil rightClick:nil];
    self.navigationItem.title = @"债权转让";
    
    _backView.layer.shadowColor = [UIColor grayColor].CGColor;
    _backView.layer.shadowOffset = CGSizeMake(0.5, 0.5);
    _backView.layer.shadowOpacity = YES;
    
    
    _zhuanrangbianhao.text = _bianhao;
    _zhuanrangjiage.text = _zhuanrang;
    _Reimbursement.text = _fangshi;
    _data.text = _riqi;
    
    
}

//点击取消转让
- (IBAction)transferred:(id)sender {
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"是否取消转让?" delegate: nil cancelButtonTitle:@"确定" otherButtonTitles:@"取消", nil];
    alert.delegate = self;
    [alert show];
    
    
}

//跳转
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    if (buttonIndex == 0) {
        [self getDeteltransferred];
    }
    
}

//取消转让接口
-(void)getDeteltransferred{
    
    NSString *loginId = [[NSUserDefaults standardUserDefaults] objectForKey:@"LoginId"];
    
    
    NSDictionary *para = @{
                           @"LoginId":loginId,
                           @"TransfeId":_TranID
                           };
    [NetWorkManager requestWithType:HttpRequestTypePost withMethodName:@"Transfer.GetDeteltransferred" withParaments:para withSuccessBlock:^(NSDictionary *object) {
        if ([object[@"Code"] isEqualToString:@"00000"]) {
            [ToastView showInfoWithStatus:object[@"Message"]];
            [self.navigationController popToRootViewControllerAnimated:YES];
        }else
        {
            [ToastView showInfoWithStatus:object[@"Message"]];
        }
        
    } withFailureBlock:^(NSError *error) {
        NSLog(@"%@",error);
        [ToastView showErrorWithStatus:@"网络请求失败"];
    } progress:nil];
    
}

@end
